<template>
  <div id="app">
    <h1>{{ msg }}</h1>
    <div class="enter">
      <input type="text" v-model="content">
      <button class="btn" v-on:click="createTodo">Add</button>
    </div>
    <ul>
      <!--      <li v-for="(item, index) in todos" v-bind:key="index">{{ item }}</li>-->
      <li v-for="(item, index) in todos" :key="index">
        {{ item }}
      </li>
    </ul>
  </div>
</template>

<script>

export default {
  name: 'App',
  data() {
    return {
      content: '',
      msg: 'hello TodoList!!!',
      todos: [
        'task 1',
        'task 2',
        'task 3',
        'task 4',
      ]
    }
  },
  created() {
    this.todos.push('created todo')
  },
  mounted() {
    this.todos.push('mounted todo')
  },
  methods: {
    createTodo() {
      // console.log(this.content)
      this.todos.push(this.content)
      this.content = ''
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

  .btn {
    height: 50px;
    padding: 0 20px;
    color: aqua;
    border: 1px solid #f0f;
  }
</style>
